import java.util.ArrayList;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;

public final class FuMath {
	public static final void main(String[] args) {
		for(String arg:args) {
			FuParser fup = new FuParser(arg);
			ArrayList<String> lines = fup.Lines();
			ArrayList<String> originale = fup.originalLines();
			FuCore fuc = new FuCore(lines);
			ArrayList<String> finale = fuc.Get();
			try {
				PrintWriter out = new PrintWriter(new FileWriter(arg+".math"));
				for(int i = 0;i < lines.size();i++) {
					out.printf("%s = %s\n",originale.get(i),finale.get(i));
				}
				out.close();
			}
			catch (IOException E) {
				System.out.println(E.toString());
			}
		}
	}
}

